local yingshui = fk.CreateSkill{
    name = "tyj_heg__yingshui",
}
local H = require "packages.ol_hegemony.util"
Fk:loadTranslationTable{
      ["tyj_heg__yingshui"]="营说",
      [":tyj_heg__yingshui"]="其他角色获得你的牌后，你可以令其选择一项：1.令你移动其场上的一张牌；2.本回合内不能再使用牌。",
      ["#tyj_heg__yingshui-invoke"]="是否对 %dest 发动 营说 ？",
      ["#tyj_heg__yingshui-promt"]="营说：请选择一项",
      ["#tyj_heg__yingshui-tomove"]="被移走牌",
      ["#tyj_heg__yingshui-toprohibit"]="不能使用牌",
      ["@@tyj_heg__yingshui_prohibit-turn"]="营说",
      ["#tyj_heg__yingshui-ask"]="营说：选择要将 %dest 场上的牌移动给的角色",
      ["#tyj_heg__yingshui_prohibit"]="营说",
      ["tyj_heg__fuyuan"]="扶援",
      [":tyj_heg__fuyuan"]="你的上下家成为【杀】的目标后，你可以交给其一张手牌。结束阶段，你可以将一张牌当【远交近攻】对一名没有手牌的角色使用。",
      ["#tyj_heg__fuyuan_slash-invoke"]="是否发动 扶援 交给 %dest 一张牌？",
      ["#tyj_heg__fuyuan_end-invoke"]="是否发动 扶援 将一张牌当【远交近攻】对一名没有手牌的角色使用？",
      ["#tyj_heg__fuyuan_prohibit"]="扶援",
      ["$tyj_heg__yingshui1"]="道之以德，齐之以礼。",
      ["$tyj_heg__yingshui2"]="施恩行惠，赡之以义。",
      ["$tyj_heg__fuyuan1"]="今君困顿，扶援相助。",
      ["$tyj_heg__fuyuan2"]="恤君之患，以相扶援。",
      ["~tyj_heg__chendeng"]="吾疾无人可治。",
    }
    yingshui:addEffect(fk.AfterCardsMove, {
        can_trigger = function(self, event, target, player, data)
    if player:hasSkill(yingshui.name) then
      for _, move in ipairs(data) do
        if move.from == player and move.to and move.to ~= player and move.toArea == Card.PlayerHand then
          for _, info in ipairs(move.moveInfo) do
            if info.fromArea == Card.PlayerHand or info.fromArea == Card.PlayerEquip then
              return true
            end
          end
        end
      end
    end
  end,
  on_trigger = function(self, event, target, player, data)
    local room = player.room
    local tos = {}
    for _, move in ipairs(data) do
      if move.from == player and move.to and move.to ~= player and move.toArea == Card.PlayerHand then
        for _, info in ipairs(move.moveInfo) do
          if info.fromArea == Card.PlayerHand or info.fromArea == Card.PlayerEquip then
            table.insertIfNeed(tos, move.to)
            break
          end
        end
      end
    end
    room:sortByAction(tos)
    for _, to in ipairs(tos) do
      if not player:hasSkill(yingshui.name) then break end
      if to and not to.dead then
        event:setCostData(self, {tos = {to}})
        self:doCost(event, to, player, data)
      end
    end
  end,
  on_cost = function (self, event, target, player, data)
    local room = player.room
    local target = event:getCostData(self).tos[1]
    return room:askToSkillInvoke(player, {
        skill_name = yingshui.name,
        prompt = "#tyj_heg__yingshui-invoke::"..target.id,
      })
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local target = event:getCostData(self).tos[1]
    room:doIndicate(player.id,{target.id})
    local all_choices = {"#tyj_heg__yingshui-tomove","#tyj_heg__yingshui-toprohibit"}
    local choices = table.clone(all_choices)
    if #target:getCardIds("ej") == 0 then
      table.remove(choices, 1)
    end
    local result = room:askToChoice(target, {
      choices = choices,
      skill_name = yingshui.name,
      all_choices = all_choices,
    })
        if result == "#tyj_heg__yingshui-tomove" then
            local targets = table.filter(room.alive_players, function(p)
        return target:canMoveCardsInBoardTo(p, nil)
      end)
      if #targets == 0 then return end
      local t = room:askToChoosePlayers(player, {
        targets = targets,
        min_num = 1,
        max_num = 1,
        prompt = "#tyj_heg__yingshui-ask::" .. target.id,
        skill_name = yingshui.name,
        cancelable = false,
      })
      if #t > 0 then
        room:askToMoveCardInBoard(player, {
          target_one = target,
          target_two = t[1],
          skill_name = yingshui.name,
          move_from = target,
        })
      end
        else
          room:setPlayerMark(target,"@@tyj_heg__yingshui_prohibit-turn",1)
        end
    end,
    })
    yingshui:addEffect("prohibit", {
  prohibit_use = function(self, player, card)
    return player:getMark("@@tyj_heg__yingshui_prohibit-turn") > 0
  end,
})
return yingshui